package com.yzd.learnjava.containers;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

import com.yzd.learnjava.util.Countries;
import com.yzd.learnjava.util.Print;

public class ReadOnly {
	static Collection<String> data = new ArrayList<String>(Countries.names(6));
	public static void main(String[] args) {
		Collection<String> c = Collections.unmodifiableCollection(new ArrayList<String>(data));
		Print.print(c);
		
		List<String> a = Collections.unmodifiableList(new ArrayList<String>(data));
		ListIterator<String> it = a.listIterator();
		Print.print(it.next());
		//it.add("one");
		
		Set<String> s = Collections.unmodifiableSet(new TreeSet<String>(data));
		Print.print(s);
		//s.add("one");
		
		Set<String> ss = Collections.unmodifiableSortedSet(new TreeSet<String>(data));
		
		
		Map<String, String> m = Collections.unmodifiableMap(new HashMap<String, String>(Countries.capitals(6)));
		Print.print(m);
		//m.put("Ralph", "Howdy");
		
		Map<String, String> sm = Collections.unmodifiableSortedMap(new TreeMap<String, String>(Countries.capitals(6)));
		
	}
}
